home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / shells / scsh-0.4 / scsh-0 / scsh-0.4.2 / prescheme.h < prev    next >
C/C++ Source or Header  |  1995-10-13  |  1KB  |  37 lines

  1.  
  2. #include <errno.h>
  3.  
  4. #define PS_GETC(PORT,RESULT)      /* RESULT = getc(PORT); */ \
  5. /* optional definition for Unixes that are even more losing than usual */ \
  6. {                                          \
  7.   FILE * TTport = PORT;               \
  8.   int errorp;                   \
  9.   while (EOF == (RESULT = getc(TTport))       \
  10.      && (errorp = ferror(TTport),       \
  11.          clearerr(TTport),           \
  12.          (errorp && errno == EINTR)))  \
  13.     ;                       \
  14. }
  15. /* The trouble with the above is that all read errors look like
  16.    EOF's.  */
  17.  
  18. /* C shifts may not work if the amount is greater than the machine word size */
  19. /* Patched by JAR 6/6/93 */
  20.  
  21. #define PS_SHIFT_RIGHT(X,Y,RESULT)   \
  22. {                                    \
  23.   long TTx = X,  TTy = Y;            \
  24.   RESULT = TTy >= 32 ? (TTx < 0 ? -1 : 0) : TTx >> TTy; \
  25. }  
  26.  
  27. #define PS_SHIFT_LEFT(X,Y,RESULT)    \
  28. {                                    \
  29.   long TTy = Y;                      \
  30.   RESULT = TTy >= 32 ? 0 : X << TTy; \
  31. }  
  32.  
  33. #define PS_SMALL_MULTIPLY(x,y) ((x) * (y))
  34.  
  35. extern long TTreturn_value, TTrun_machine();
  36. extern FILE *ps_open(char *, char *);
  37.